<?php

namespace App\Admin\Actions\Grid\RowActions;
use App\Admin\Forms\UploadAgreementForm;
use Dcat\Admin\Widgets\Modal;
use Dcat\Admin\Grid\RowAction;

class UploadAgreementAction extends RowAction
{

    public function __construct($title = null)
    {
        $title = '<a href="javascript:;" style="margin-right: 10px;" class="text-custom"><i class="fa fa-upload"></i> <span>'. $title . '</span></a>';
        parent::__construct($title);
    }

    public function render()
    {
        // 实例化表单类并传递自定义参数
        $form = UploadAgreementForm::make()->payload([
            'row' => $this->getRow()
        ]);

        return Modal::make()
            ->lg()
            ->title($this->title)
            ->body($form)
            ->button($this->title);
    }
}
